<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
	<title></title>
	<style type="text/css">
		#jian,#main,#jia,#danjia{
			width: 50px;
			height: 50px;
			border: 1px solid red;
			float: left;
			margin-left: 10px;
			line-height: 50px;
			text-align: center;
		}
	</style>
</head>
<body>
    <div id="jian" onclick="jian()">减</div>
     <div id="main">100</div>
      <div id="jia" onclick="jia()">加</div>
       <div id="danjia"></div><div>这个就是单价</div>
       <script type="text/javascript">
       var jianum = document.getElementById("main");
       // 这个就是单价,我要给的变量
       var danjia =  document.getElementById("danjia");
       danjia.innerHTML =jianum.innerHTML;
       	   function jia(){
    var nn =parseInt(jianum.innerHTML)+parseInt(danjia.innerHTML);
  jianum.innerHTML = parseInt(nn);
       	   }
       	  function jian(){
       	  	var ss = parseInt(jianum.innerHTML)-parseInt(danjia.innerHTML);
       	  	  if (jianum.innerHTML<=danjia.innerHTML) {
       	  	  	alert("已经达到最小值");
       	  	  	ss = danjia.innerHTML;
       	  	  }
       	  	   jianum.innerHTML = parseInt(ss);
       	  }
       </script>
</body>
</html>